import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
  state:{
    info:null,
    merchantId:null,
    session_token:null,
    openId:null,
  },
  mutations:{
    getUserId(state,data){
      state.merchantId = data.merchant.merchantId
      localStorage.setItem('userId',JSON.stringify(data.merchant.merchantId))
    },
    getSessionToken(state,token){
      state.session_token = token;
      sessionStorage.setItem('session_token',JSON.stringify(token));
    },
    getOpenId(state,openId){
      state.openId = openId;
      sessionStorage.setItem('openId',JSON.stringify(openId));
    }
  }
})
export default store
